Skip to content

feat: print GPU name and VRAM at startup#177

Open
tykoo-chen wants to merge 1 commit intokarpathy:masterfrom
tykoo-chen:feat/print-gpu-info
Open

feat: print GPU name and VRAM at startup#177
tykoo-chen wants to merge 1 commit intokarpathy:masterfrom
tykoo-chen:feat/print-gpu-info

Conversation

@tykoo-chen
Copy link

Problem

When running train.py, there's no indication of which GPU is being used or how much VRAM is available. This makes it harder to:

  • Verify the script is using the expected GPU (on multi-GPU systems)
  • Debug OOM issues
  • Compare results across different hardware

Solution

Print GPU name and VRAM at startup:

gpu_name = torch.cuda.get_device_name(0)
gpu_vram_gb = torch.cuda.get_device_properties(0).total_memory / 1024**3
print(f"GPU: {gpu_name} ({gpu_vram_gb:.1f} GB)")

Example Output

GPU: NVIDIA H100 80GB HBM3 (79.6 GB)
Vocab size: 8,192
Model config: {...}

Benefits

  • Easier debugging and verification
  • Useful context when sharing results or reporting issues
  • Minimal code change, no new dependencies

Adds GPU information to the startup log for easier debugging and
verification. Helps users confirm they're running on the expected
hardware, especially useful on multi-GPU systems.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant